package com.dragon.repository.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dragon.repository.entity.AdminPosition;
import com.dragon.repository.entity.Position;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户岗位关联表 Mapper 接口
 * </p>
 *
 * @author sy
 * @since 2023-06-14
 */
@Mapper
public interface AdminPositionMapper extends BaseMapper<AdminPosition> {


    @Select("select b.* from dragon_admin_position a,dragon_position b where a.position_id = b.id and a.admin_id = #{id} and b.state = 1")
    Position selectPositionInfoByAdminId(Integer id);

    @Select("select a.* from dragon_admin_position a " +
            "LEFT JOIN dragon_admin b on a.admin_id = b.id WHERE b.deleted = 0 and a.position_id = #{positionId}")
    List<AdminPosition> selectByAdminDeleted(Integer positionId);
}
